<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>sqs.connection</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="sqs-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="sqs-module.html">Package&nbsp;sqs</a> ::
        Module&nbsp;connection
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="sqs.connection-pysrc.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="sqs.connection-module.html">Module sqs.connection</a></h1>
<pre class="py-src">
<tt class="py-lineno">  1</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">re</tt> </tt>
<tt class="py-lineno">  2</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">sha</tt> </tt>
<tt class="py-lineno">  3</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">hmac</tt> </tt>
<tt class="py-lineno">  4</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">time</tt> </tt>
<tt class="py-lineno">  5</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">base64</tt> </tt>
<tt class="py-lineno">  6</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">socket</tt> </tt>
<tt class="py-lineno">  7</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">urllib</tt> </tt>
<tt class="py-lineno">  8</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">httplib</tt> </tt>
<tt class="py-lineno">  9</tt>  <tt class="py-line"> </tt>
<tt class="py-lineno"> 10</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt id="link-0" class="py-name" targets="Package sqs=sqs-module.html"><a title="sqs" class="py-name" href="#" onclick="return doclink('link-0', 'sqs', 'link-0');">sqs</a></tt></tt> </tt>
<tt class="py-lineno"> 11</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-1" class="py-name"><a title="sqs" class="py-name" href="#" onclick="return doclink('link-1', 'sqs', 'link-0');">sqs</a></tt></tt><tt class="py-op">.</tt><tt id="link-2" class="py-name" targets="Module sqs.parsers=sqs.parsers-module.html"><a title="sqs.parsers" class="py-name" href="#" onclick="return doclink('link-2', 'parsers', 'link-2');">parsers</a></tt></tt> <tt class="py-keyword">import</tt> <tt id="link-3" class="py-name" targets="Function sqs.parsers.parseError()=sqs.parsers-module.html#parseError"><a title="sqs.parsers.parseError" class="py-name" href="#" onclick="return doclink('link-3', 'parseError', 'link-3');">parseError</a></tt></tt> </tt>
<tt class="py-lineno"> 12</tt>  <tt class="py-line"> </tt>
<tt class="py-lineno"> 13</tt>  <tt class="py-line"> </tt>
<tt class="py-lineno"> 14</tt>  <tt class="py-line"><tt id="link-4" class="py-name" targets="Variable sqs.connection.DEFAULT_CONTENT_TYPE=sqs.connection-module.html#DEFAULT_CONTENT_TYPE,Variable sqs.generator.DEFAULT_CONTENT_TYPE=sqs.generator-module.html#DEFAULT_CONTENT_TYPE"><a title="sqs.connection.DEFAULT_CONTENT_TYPE
sqs.generator.DEFAULT_CONTENT_TYPE" class="py-name" href="#" onclick="return doclink('link-4', 'DEFAULT_CONTENT_TYPE', 'link-4');">DEFAULT_CONTENT_TYPE</a></tt></tt> <tt class="py-op">=</tt> <tt class="py-string">'text/plain'</tt> </tt>
<tt class="py-lineno"> 15</tt>  <tt class="py-line"><tt id="link-5" class="py-name" targets="Variable sqs.connection.PORTS_BY_SECURITY=sqs.connection-module.html#PORTS_BY_SECURITY,Variable sqs.generator.PORTS_BY_SECURITY=sqs.generator-module.html#PORTS_BY_SECURITY"><a title="sqs.connection.PORTS_BY_SECURITY
sqs.generator.PORTS_BY_SECURITY" class="py-name" href="#" onclick="return doclink('link-5', 'PORTS_BY_SECURITY', 'link-5');">PORTS_BY_SECURITY</a></tt></tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt> <tt class="py-name">True</tt><tt class="py-op">:</tt> <tt class="py-number">443</tt><tt class="py-op">,</tt> <tt class="py-name">False</tt><tt class="py-op">:</tt> <tt class="py-number">80</tt> <tt class="py-op">}</tt> </tt>
<tt class="py-lineno"> 16</tt>  <tt class="py-line"> </tt>
<a name="SQSConnection"></a><div id="SQSConnection-def"><tt class="py-lineno"> 17</tt> <a class="py-toggle" href="#" id="SQSConnection-toggle" onclick="return toggle('SQSConnection');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="sqs.connection.SQSConnection-class.html">SQSConnection</a><tt class="py-op">(</tt><tt class="py-base-class">object</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="SQSConnection-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="SQSConnection-expanded"><tt class="py-lineno"> 18</tt>  <tt class="py-line">    <tt class="py-docstring">"""SQS Connection class.</tt> </tt>
<tt class="py-lineno"> 19</tt>  <tt class="py-line"><tt class="py-docstring">    </tt> </tt>
<tt class="py-lineno"> 20</tt>  <tt class="py-line"><tt class="py-docstring">    You shoud never use this class directly. User SQSService instead.</tt> </tt>
<tt class="py-lineno"> 21</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="SQSConnection.__init__"></a><div id="SQSConnection.__init__-def"><tt class="py-lineno"> 22</tt> <a class="py-toggle" href="#" id="SQSConnection.__init__-toggle" onclick="return toggle('SQSConnection.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="sqs.connection.SQSConnection-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">pub_key</tt><tt class="py-op">,</tt> <tt class="py-param">priv_key</tt><tt class="py-op">,</tt> <tt class="py-param">host</tt><tt class="py-op">=</tt><tt id="link-6" class="py-name"><a title="sqs" class="py-name" href="#" onclick="return doclink('link-6', 'sqs', 'link-0');">sqs</a></tt></tt><tt class="py-op">.</tt><tt id="link-7" class="py-name" targets="Variable sqs.DEFAULT_HOST=sqs-module.html#DEFAULT_HOST"><a title="sqs.DEFAULT_HOST" class="py-name" href="#" onclick="return doclink('link-7', 'DEFAULT_HOST', 'link-7');">DEFAULT_HOST</a></tt></tt><tt class="py-op">,</tt> <tt class="py-param">port</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-param">secure</tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">,</tt> <tt class="py-param">debug</tt><tt class="py-op">=</tt><tt class="py-number">0</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="SQSConnection.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SQSConnection.__init__-expanded"><tt class="py-lineno"> 23</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_pub_key</tt> <tt class="py-op">=</tt> <tt class="py-name">pub_key</tt> </tt>
<tt class="py-lineno"> 24</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_priv_key</tt> <tt class="py-op">=</tt> <tt class="py-name">priv_key</tt> </tt>
<tt class="py-lineno"> 25</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_host</tt> <tt class="py-op">=</tt> <tt class="py-name">host</tt> </tt>
<tt class="py-lineno"> 26</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">port</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 27</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_port</tt> <tt class="py-op">=</tt> <tt id="link-8" class="py-name"><a title="sqs.connection.PORTS_BY_SECURITY
sqs.generator.PORTS_BY_SECURITY" class="py-name" href="#" onclick="return doclink('link-8', 'PORTS_BY_SECURITY', 'link-5');">PORTS_BY_SECURITY</a></tt></tt><tt class="py-op">[</tt><tt class="py-name">secure</tt><tt class="py-op">]</tt> </tt>
<tt class="py-lineno"> 28</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 29</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_port</tt> <tt class="py-op">=</tt> <tt class="py-name">port</tt> </tt>
<tt class="py-lineno"> 30</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_secure</tt> <tt class="py-op">=</tt> <tt class="py-name">secure</tt> </tt>
<tt class="py-lineno"> 31</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-op">(</tt><tt class="py-name">secure</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 32</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_conn</tt> <tt class="py-op">=</tt> <tt class="py-name">httplib</tt><tt class="py-op">.</tt><tt class="py-name">HTTPSConnection</tt><tt class="py-op">(</tt><tt class="py-string">"%s:%d"</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_host</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_port</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 33</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 34</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_conn</tt> <tt class="py-op">=</tt> <tt class="py-name">httplib</tt><tt class="py-op">.</tt><tt class="py-name">HTTPConnection</tt><tt class="py-op">(</tt><tt class="py-string">"%s:%d"</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_host</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_port</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 35</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-9" class="py-name" targets="Method sqs.connection.SQSConnection._set_debug()=sqs.connection.SQSConnection-class.html#_set_debug"><a title="sqs.connection.SQSConnection._set_debug" class="py-name" href="#" onclick="return doclink('link-9', '_set_debug', 'link-9');">_set_debug</a></tt></tt><tt class="py-op">(</tt><tt class="py-name">debug</tt><tt class="py-op">)</tt> </tt>
</div><tt class="py-lineno"> 36</tt>  <tt class="py-line"> </tt>
<tt class="py-lineno"> 37</tt>  <tt class="py-line"> </tt>
<a name="SQSConnection._set_debug"></a><div id="SQSConnection._set_debug-def"><tt class="py-lineno"> 38</tt> <a class="py-toggle" href="#" id="SQSConnection._set_debug-toggle" onclick="return toggle('SQSConnection._set_debug');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="sqs.connection.SQSConnection-class.html#_set_debug">_set_debug</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">debug</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="SQSConnection._set_debug-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SQSConnection._set_debug-expanded"><tt class="py-lineno"> 39</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_debug</tt> <tt class="py-op">=</tt> <tt class="py-name">debug</tt> </tt>
<tt class="py-lineno"> 40</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_conn</tt><tt class="py-op">.</tt><tt class="py-name">set_debuglevel</tt><tt class="py-op">(</tt><tt class="py-name">debug</tt><tt class="py-op">)</tt> </tt>
</div><tt class="py-lineno"> 41</tt>  <tt class="py-line"> </tt>
<tt class="py-lineno"> 42</tt>  <tt class="py-line"> </tt>
<a name="SQSConnection.clone"></a><div id="SQSConnection.clone-def"><tt class="py-lineno"> 43</tt> <a class="py-toggle" href="#" id="SQSConnection.clone-toggle" onclick="return toggle('SQSConnection.clone');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="sqs.connection.SQSConnection-class.html#clone">clone</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="SQSConnection.clone-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SQSConnection.clone-expanded"><tt class="py-lineno"> 44</tt>  <tt class="py-line">        <tt class="py-docstring">"""C.clone() -&gt; new connection to sqs"""</tt> </tt>
<tt class="py-lineno"> 45</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt id="link-10" class="py-name" targets="Class sqs.connection.SQSConnection=sqs.connection.SQSConnection-class.html"><a title="sqs.connection.SQSConnection" class="py-name" href="#" onclick="return doclink('link-10', 'SQSConnection', 'link-10');">SQSConnection</a></tt></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_pub_key</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_priv_key</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_host</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_port</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_secure</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_debug</tt><tt class="py-op">)</tt> </tt>
</div><tt class="py-lineno"> 46</tt>  <tt class="py-line"> </tt>
<tt class="py-lineno"> 47</tt>  <tt class="py-line"> </tt>
<a name="SQSConnection._auth_header_value"></a><div id="SQSConnection._auth_header_value-def"><tt class="py-lineno"> 48</tt> <a class="py-toggle" href="#" id="SQSConnection._auth_header_value-toggle" onclick="return toggle('SQSConnection._auth_header_value');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="sqs.connection.SQSConnection-class.html#_auth_header_value">_auth_header_value</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">method</tt><tt class="py-op">,</tt> <tt class="py-param">path</tt><tt class="py-op">,</tt> <tt class="py-param">headers</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="SQSConnection._auth_header_value-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SQSConnection._auth_header_value-expanded"><tt class="py-lineno"> 49</tt>  <tt class="py-line">        <tt class="py-name">path</tt> <tt class="py-op">=</tt> <tt class="py-name">path</tt><tt class="py-op">.</tt><tt class="py-name">split</tt><tt class="py-op">(</tt><tt class="py-string">'?'</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> </tt>
<tt class="py-lineno"> 50</tt>  <tt class="py-line">        <tt class="py-comment"># ...unless there is an acl parameter</tt> </tt>
<tt class="py-lineno"> 51</tt>  <tt class="py-line"><tt class="py-comment"></tt>        <tt class="py-keyword">if</tt> <tt class="py-name">re</tt><tt class="py-op">.</tt><tt class="py-name">search</tt><tt class="py-op">(</tt><tt class="py-string">"[&amp;?]acl($|=|&amp;)"</tt><tt class="py-op">,</tt> <tt class="py-name">path</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 52</tt>  <tt class="py-line">            <tt class="py-name">path</tt> <tt class="py-op">+=</tt> <tt class="py-string">"?acl"</tt> </tt>
<tt class="py-lineno"> 53</tt>  <tt class="py-line">        <tt class="py-name">auth_parts</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-name">method</tt><tt class="py-op">,</tt> </tt>
<tt class="py-lineno"> 54</tt>  <tt class="py-line">                      <tt class="py-name">headers</tt><tt class="py-op">.</tt><tt id="link-11" class="py-name" targets="Method sqs.service.SQSService.get()=sqs.service.SQSService-class.html#get"><a title="sqs.service.SQSService.get" class="py-name" href="#" onclick="return doclink('link-11', 'get', 'link-11');">get</a></tt></tt><tt class="py-op">(</tt><tt class="py-string">"Content-MD5"</tt><tt class="py-op">,</tt> <tt class="py-string">""</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<tt class="py-lineno"> 55</tt>  <tt class="py-line">                      <tt class="py-name">headers</tt><tt class="py-op">.</tt><tt id="link-12" class="py-name"><a title="sqs.service.SQSService.get" class="py-name" href="#" onclick="return doclink('link-12', 'get', 'link-11');">get</a></tt></tt><tt class="py-op">(</tt><tt class="py-string">"Content-Type"</tt><tt class="py-op">,</tt> <tt id="link-13" class="py-name"><a title="sqs.connection.DEFAULT_CONTENT_TYPE
sqs.generator.DEFAULT_CONTENT_TYPE" class="py-name" href="#" onclick="return doclink('link-13', 'DEFAULT_CONTENT_TYPE', 'link-4');">DEFAULT_CONTENT_TYPE</a></tt></tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<tt class="py-lineno"> 56</tt>  <tt class="py-line">                      <tt class="py-name">headers</tt><tt class="py-op">.</tt><tt id="link-14" class="py-name"><a title="sqs.service.SQSService.get" class="py-name" href="#" onclick="return doclink('link-14', 'get', 'link-11');">get</a></tt></tt><tt class="py-op">(</tt><tt class="py-string">"Date"</tt><tt class="py-op">,</tt> <tt class="py-name">time</tt><tt class="py-op">.</tt><tt class="py-name">strftime</tt><tt class="py-op">(</tt><tt class="py-string">"%a, %d %b %Y %X GMT"</tt><tt class="py-op">,</tt> <tt class="py-name">time</tt><tt class="py-op">.</tt><tt class="py-name">gmtime</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<tt class="py-lineno"> 57</tt>  <tt class="py-line">                      <tt class="py-name">path</tt><tt class="py-op">]</tt> </tt>
<tt class="py-lineno"> 58</tt>  <tt class="py-line">        <tt class="py-name">auth_str</tt> <tt class="py-op">=</tt> <tt class="py-string">"\n"</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">auth_parts</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 59</tt>  <tt class="py-line">        <tt class="py-name">auth_str</tt> <tt class="py-op">=</tt> <tt class="py-name">base64</tt><tt class="py-op">.</tt><tt class="py-name">encodestring</tt><tt class="py-op">(</tt> </tt>
<tt class="py-lineno"> 60</tt>  <tt class="py-line">            <tt class="py-name">hmac</tt><tt class="py-op">.</tt><tt class="py-name">new</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_priv_key</tt><tt class="py-op">,</tt> <tt class="py-name">auth_str</tt><tt class="py-op">,</tt> <tt class="py-name">sha</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">digest</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">strip</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 61</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-string">"AWS %s:%s"</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_pub_key</tt><tt class="py-op">,</tt> <tt class="py-name">auth_str</tt><tt class="py-op">)</tt> </tt>
</div><tt class="py-lineno"> 62</tt>  <tt class="py-line"> </tt>
<tt class="py-lineno"> 63</tt>  <tt class="py-line"> </tt>
<a name="SQSConnection._headers"></a><div id="SQSConnection._headers-def"><tt class="py-lineno"> 64</tt> <a class="py-toggle" href="#" id="SQSConnection._headers-toggle" onclick="return toggle('SQSConnection._headers');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="sqs.connection.SQSConnection-class.html#_headers">_headers</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">method</tt><tt class="py-op">,</tt> <tt class="py-param">path</tt><tt class="py-op">,</tt> <tt class="py-param">length</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-param">headers</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="SQSConnection._headers-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SQSConnection._headers-expanded"><tt class="py-lineno"> 65</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">headers</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 66</tt>  <tt class="py-line">            <tt class="py-name">headers</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt> </tt>
<tt class="py-lineno"> 67</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">headers</tt><tt class="py-op">.</tt><tt class="py-name">has_key</tt><tt class="py-op">(</tt><tt class="py-string">'Date'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 68</tt>  <tt class="py-line">            <tt class="py-name">headers</tt><tt class="py-op">[</tt><tt class="py-string">"Date"</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">time</tt><tt class="py-op">.</tt><tt class="py-name">strftime</tt><tt class="py-op">(</tt><tt class="py-string">"%a, %d %b %Y %H:%M:%S GMT"</tt><tt class="py-op">,</tt> <tt class="py-name">time</tt><tt class="py-op">.</tt><tt class="py-name">gmtime</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 69</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">headers</tt><tt class="py-op">.</tt><tt class="py-name">has_key</tt><tt class="py-op">(</tt><tt class="py-string">'AWS-Version'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 70</tt>  <tt class="py-line">            <tt class="py-name">headers</tt><tt class="py-op">[</tt><tt class="py-string">'AWS-Version'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt id="link-15" class="py-name"><a title="sqs" class="py-name" href="#" onclick="return doclink('link-15', 'sqs', 'link-0');">sqs</a></tt></tt><tt class="py-op">.</tt><tt id="link-16" class="py-name" targets="Variable sqs.VERSION=sqs-module.html#VERSION"><a title="sqs.VERSION" class="py-name" href="#" onclick="return doclink('link-16', 'VERSION', 'link-16');">VERSION</a></tt></tt> </tt>
<tt class="py-lineno"> 71</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">headers</tt><tt class="py-op">.</tt><tt class="py-name">has_key</tt><tt class="py-op">(</tt><tt class="py-string">'Content-Type'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 72</tt>  <tt class="py-line">            <tt class="py-name">headers</tt><tt class="py-op">[</tt><tt class="py-string">'Content-Type'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt id="link-17" class="py-name"><a title="sqs.connection.DEFAULT_CONTENT_TYPE
sqs.generator.DEFAULT_CONTENT_TYPE" class="py-name" href="#" onclick="return doclink('link-17', 'DEFAULT_CONTENT_TYPE', 'link-4');">DEFAULT_CONTENT_TYPE</a></tt></tt> </tt>
<tt class="py-lineno"> 73</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">headers</tt><tt class="py-op">.</tt><tt class="py-name">has_key</tt><tt class="py-op">(</tt><tt class="py-string">'Content-MD5'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 74</tt>  <tt class="py-line">            <tt class="py-name">headers</tt><tt class="py-op">[</tt><tt class="py-string">'Content-MD5'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt> </tt>
<tt class="py-lineno"> 75</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">headers</tt><tt class="py-op">.</tt><tt class="py-name">has_key</tt><tt class="py-op">(</tt><tt class="py-string">'Content-Length'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 76</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">length</tt> <tt class="py-keyword">is</tt> <tt class="py-keyword">not</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 77</tt>  <tt class="py-line">                <tt class="py-name">headers</tt><tt class="py-op">[</tt><tt class="py-string">'Content-Length'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">length</tt> </tt>
<tt class="py-lineno"> 78</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 79</tt>  <tt class="py-line">                <tt class="py-name">headers</tt><tt class="py-op">[</tt><tt class="py-string">'Content-Length'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
<tt class="py-lineno"> 80</tt>  <tt class="py-line">        <tt class="py-name">headers</tt><tt class="py-op">[</tt><tt class="py-string">"Authorization"</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-18" class="py-name" targets="Method sqs.connection.SQSConnection._auth_header_value()=sqs.connection.SQSConnection-class.html#_auth_header_value,Method sqs.generator.SQSGenerator._auth_header_value()=sqs.generator.SQSGenerator-class.html#_auth_header_value"><a title="sqs.connection.SQSConnection._auth_header_value
sqs.generator.SQSGenerator._auth_header_value" class="py-name" href="#" onclick="return doclink('link-18', '_auth_header_value', 'link-18');">_auth_header_value</a></tt></tt><tt class="py-op">(</tt><tt class="py-name">method</tt><tt class="py-op">,</tt> <tt class="py-name">path</tt><tt class="py-op">,</tt> <tt class="py-name">headers</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 81</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">headers</tt> </tt>
</div><tt class="py-lineno"> 82</tt>  <tt class="py-line"> </tt>
<a name="SQSConnection._params"></a><div id="SQSConnection._params-def"><tt class="py-lineno"> 83</tt> <a class="py-toggle" href="#" id="SQSConnection._params-toggle" onclick="return toggle('SQSConnection._params');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="sqs.connection.SQSConnection-class.html#_params">_params</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">params</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="SQSConnection._params-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SQSConnection._params-expanded"><tt class="py-lineno"> 84</tt>  <tt class="py-line">        <tt class="py-name">p</tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt> </tt>
<tt class="py-lineno"> 85</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">params</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 86</tt>  <tt class="py-line">            <tt class="py-name">p</tt> <tt class="py-op">=</tt> <tt class="py-string">'?'</tt> <tt class="py-op">+</tt> <tt class="py-name">urllib</tt><tt class="py-op">.</tt><tt class="py-name">urlencode</tt><tt class="py-op">(</tt><tt class="py-name">params</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 87</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">p</tt> </tt>
</div><tt class="py-lineno"> 88</tt>  <tt class="py-line"> </tt>
<a name="SQSConnection._path"></a><div id="SQSConnection._path-def"><tt class="py-lineno"> 89</tt> <a class="py-toggle" href="#" id="SQSConnection._path-toggle" onclick="return toggle('SQSConnection._path');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="sqs.connection.SQSConnection-class.html#_path">_path</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">queue</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-param">message</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="SQSConnection._path-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SQSConnection._path-expanded"><tt class="py-lineno"> 90</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">queue</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 91</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-string">"/"</tt> </tt>
<tt class="py-lineno"> 92</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">message</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 93</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-name">queue</tt> </tt>
<tt class="py-lineno"> 94</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">queue</tt> <tt class="py-op">+</tt> <tt class="py-string">"/"</tt> <tt class="py-op">+</tt> <tt class="py-name">message</tt> </tt>
</div><tt class="py-lineno"> 95</tt>  <tt class="py-line"> </tt>
<a name="SQSConnection._io_len"></a><div id="SQSConnection._io_len-def"><tt class="py-lineno"> 96</tt> <a class="py-toggle" href="#" id="SQSConnection._io_len-toggle" onclick="return toggle('SQSConnection._io_len');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="sqs.connection.SQSConnection-class.html#_io_len">_io_len</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">io</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="SQSConnection._io_len-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SQSConnection._io_len-expanded"><tt class="py-lineno"> 97</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">hasattr</tt><tt class="py-op">(</tt><tt class="py-name">io</tt><tt class="py-op">,</tt> <tt class="py-string">"len"</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 98</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-name">io</tt><tt class="py-op">.</tt><tt class="py-name">len</tt> </tt>
<tt class="py-lineno"> 99</tt>  <tt class="py-line">        <tt class="py-name">o_pos</tt> <tt class="py-op">=</tt> <tt class="py-name">io</tt><tt class="py-op">.</tt><tt class="py-name">tell</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">100</tt>  <tt class="py-line">        <tt class="py-name">io</tt><tt class="py-op">.</tt><tt class="py-name">seek</tt><tt class="py-op">(</tt><tt class="py-number">0</tt><tt class="py-op">,</tt> <tt class="py-number">2</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">101</tt>  <tt class="py-line">        <tt class="py-name">length</tt> <tt class="py-op">=</tt> <tt class="py-name">io</tt><tt class="py-op">.</tt><tt class="py-name">tell</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> <tt class="py-op">-</tt> <tt class="py-name">o_pos</tt> </tt>
<tt class="py-lineno">102</tt>  <tt class="py-line">        <tt class="py-name">io</tt><tt class="py-op">.</tt><tt class="py-name">seek</tt><tt class="py-op">(</tt><tt class="py-name">o_pos</tt><tt class="py-op">,</tt> <tt class="py-number">0</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">103</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">length</tt> </tt>
</div><tt class="py-lineno">104</tt>  <tt class="py-line"> </tt>
<tt class="py-lineno">105</tt>  <tt class="py-line"> </tt>
<a name="SQSConnection.__getattr__"></a><div id="SQSConnection.__getattr__-def"><tt class="py-lineno">106</tt> <a class="py-toggle" href="#" id="SQSConnection.__getattr__-toggle" onclick="return toggle('SQSConnection.__getattr__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="sqs.connection.SQSConnection-class.html#__getattr__">__getattr__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">attr</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="SQSConnection.__getattr__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SQSConnection.__getattr__-expanded"><tt class="py-lineno">107</tt>  <tt class="py-line">        <tt class="py-name">method</tt> <tt class="py-op">=</tt> <tt class="py-name">attr</tt><tt class="py-op">.</tt><tt class="py-name">upper</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">108</tt>  <tt class="py-line">        <tt class="py-keyword">def</tt> <tt class="py-def-name">f</tt><tt class="py-op">(</tt><tt class="py-param">queue</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-param">message</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-param">send_io</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-param">params</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-param">headers</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno">109</tt>  <tt class="py-line">            <tt class="py-name">path</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-19" class="py-name" targets="Method sqs.connection.SQSConnection._path()=sqs.connection.SQSConnection-class.html#_path,Method sqs.generator.SQSGenerator._path()=sqs.generator.SQSGenerator-class.html#_path"><a title="sqs.connection.SQSConnection._path
sqs.generator.SQSGenerator._path" class="py-name" href="#" onclick="return doclink('link-19', '_path', 'link-19');">_path</a></tt></tt><tt class="py-op">(</tt><tt class="py-name">queue</tt><tt class="py-op">,</tt> <tt class="py-name">message</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">110</tt>  <tt class="py-line">            <tt class="py-name">length</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
<tt class="py-lineno">111</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">headers</tt><tt class="py-op">,</tt> <tt class="py-name">dict</tt><tt class="py-op">)</tt> <tt class="py-keyword">and</tt> <tt class="py-name">headers</tt><tt class="py-op">.</tt><tt class="py-name">has_key</tt><tt class="py-op">(</tt><tt class="py-string">"Content-Length"</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno">112</tt>  <tt class="py-line">                <tt class="py-name">length</tt> <tt class="py-op">=</tt> <tt class="py-name">headers</tt><tt class="py-op">[</tt><tt class="py-string">"Content-Length"</tt><tt class="py-op">]</tt> </tt>
<tt class="py-lineno">113</tt>  <tt class="py-line">            <tt class="py-keyword">elif</tt> <tt class="py-name">send_io</tt> <tt class="py-keyword">is</tt> <tt class="py-keyword">not</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno">114</tt>  <tt class="py-line">                <tt class="py-name">length</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-20" class="py-name" targets="Method sqs.connection.SQSConnection._io_len()=sqs.connection.SQSConnection-class.html#_io_len"><a title="sqs.connection.SQSConnection._io_len" class="py-name" href="#" onclick="return doclink('link-20', '_io_len', 'link-20');">_io_len</a></tt></tt><tt class="py-op">(</tt><tt class="py-name">send_io</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">115</tt>  <tt class="py-line"> </tt>
<tt class="py-lineno">116</tt>  <tt class="py-line">            <tt class="py-name">headers</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-21" class="py-name" targets="Method sqs.connection.SQSConnection._headers()=sqs.connection.SQSConnection-class.html#_headers"><a title="sqs.connection.SQSConnection._headers" class="py-name" href="#" onclick="return doclink('link-21', '_headers', 'link-21');">_headers</a></tt></tt><tt class="py-op">(</tt><tt class="py-name">method</tt><tt class="py-op">,</tt> <tt class="py-name">path</tt><tt class="py-op">,</tt> <tt class="py-name">length</tt><tt class="py-op">=</tt><tt class="py-name">length</tt><tt class="py-op">,</tt> <tt class="py-name">headers</tt><tt class="py-op">=</tt><tt class="py-name">headers</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">117</tt>  <tt class="py-line"> </tt>
<tt class="py-lineno">118</tt>  <tt class="py-line">            <tt class="py-keyword">def</tt> <tt class="py-def-name">do_conn</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno">119</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_conn</tt><tt class="py-op">.</tt><tt class="py-name">putrequest</tt><tt class="py-op">(</tt><tt class="py-name">method</tt><tt class="py-op">,</tt> <tt class="py-name">path</tt> <tt class="py-op">+</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-22" class="py-name" targets="Method sqs.connection.SQSConnection._params()=sqs.connection.SQSConnection-class.html#_params,Method sqs.generator.SQSGenerator._params()=sqs.generator.SQSGenerator-class.html#_params"><a title="sqs.connection.SQSConnection._params
sqs.generator.SQSGenerator._params" class="py-name" href="#" onclick="return doclink('link-22', '_params', 'link-22');">_params</a></tt></tt><tt class="py-op">(</tt><tt class="py-name">params</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">120</tt>  <tt class="py-line">                <tt class="py-keyword">for</tt> <tt class="py-name">k</tt><tt class="py-op">,</tt><tt class="py-name">v</tt> <tt class="py-keyword">in</tt> <tt class="py-name">headers</tt><tt class="py-op">.</tt><tt class="py-name">items</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno">121</tt>  <tt class="py-line">                    <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_conn</tt><tt class="py-op">.</tt><tt class="py-name">putheader</tt><tt class="py-op">(</tt><tt class="py-name">k</tt><tt class="py-op">,</tt> <tt class="py-name">v</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">122</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_conn</tt><tt class="py-op">.</tt><tt class="py-name">endheaders</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
</div><tt class="py-lineno">123</tt>  <tt class="py-line"> </tt>
<tt class="py-lineno">124</tt>  <tt class="py-line">            <tt class="py-name">retry</tt> <tt class="py-op">=</tt> <tt class="py-name">False</tt> </tt>
<tt class="py-lineno">125</tt>  <tt class="py-line">            <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno">126</tt>  <tt class="py-line">                <tt class="py-name">do_conn</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">127</tt>  <tt class="py-line">            <tt class="py-keyword">except</tt> <tt class="py-name">socket</tt><tt class="py-op">.</tt><tt class="py-name">error</tt><tt class="py-op">,</tt> <tt class="py-name">e</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno">128</tt>  <tt class="py-line">                 <tt class="py-comment"># if broken pipe (timed out/server closed connection)</tt> </tt>
<tt class="py-lineno">129</tt>  <tt class="py-line"><tt class="py-comment"></tt>                 <tt class="py-comment"># open new connection and try again</tt> </tt>
<tt class="py-lineno">130</tt>  <tt class="py-line"><tt class="py-comment"></tt>                <tt class="py-keyword">if</tt> <tt class="py-name">e</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> <tt class="py-op">==</tt> <tt class="py-number">32</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno">131</tt>  <tt class="py-line">                    <tt class="py-name">retry</tt> <tt class="py-op">=</tt> <tt class="py-name">True</tt> </tt>
<tt class="py-lineno">132</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">retry</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno">133</tt>  <tt class="py-line">                <tt class="py-name">do_conn</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">134</tt>  <tt class="py-line">                 </tt>
<tt class="py-lineno">135</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">send_io</tt> <tt class="py-keyword">is</tt> <tt class="py-keyword">not</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno">136</tt>  <tt class="py-line">                <tt class="py-name">data</tt> <tt class="py-op">=</tt> <tt class="py-name">send_io</tt><tt class="py-op">.</tt><tt id="link-23" class="py-name" targets="Method sqs.objects.SQSQueue.read()=sqs.objects.SQSQueue-class.html#read"><a title="sqs.objects.SQSQueue.read" class="py-name" href="#" onclick="return doclink('link-23', 'read', 'link-23');">read</a></tt></tt><tt class="py-op">(</tt><tt class="py-name">httplib</tt><tt class="py-op">.</tt><tt class="py-name">MAXAMOUNT</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">137</tt>  <tt class="py-line">                <tt class="py-keyword">while</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">data</tt><tt class="py-op">)</tt> <tt class="py-op">&gt;</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno">138</tt>  <tt class="py-line">                    <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_conn</tt><tt class="py-op">.</tt><tt class="py-name">send</tt><tt class="py-op">(</tt><tt class="py-name">data</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">139</tt>  <tt class="py-line">                    <tt class="py-name">data</tt> <tt class="py-op">=</tt> <tt class="py-name">send_io</tt><tt class="py-op">.</tt><tt id="link-24" class="py-name"><a title="sqs.objects.SQSQueue.read" class="py-name" href="#" onclick="return doclink('link-24', 'read', 'link-23');">read</a></tt></tt><tt class="py-op">(</tt><tt class="py-name">httplib</tt><tt class="py-op">.</tt><tt class="py-name">MAXAMOUNT</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">140</tt>  <tt class="py-line">                <tt class="py-name">send_io</tt><tt class="py-op">.</tt><tt id="link-25" class="py-name"><a title="sqs.objects.SQSQueue.read" class="py-name" href="#" onclick="return doclink('link-25', 'read', 'link-23');">read</a></tt></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> <tt class="py-comment"># seems to be needed to finish the response</tt> </tt>
<tt class="py-lineno">141</tt>  <tt class="py-line">            <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno">142</tt>  <tt class="py-line">                <tt class="py-name">r</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_conn</tt><tt class="py-op">.</tt><tt class="py-name">getresponse</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">143</tt>  <tt class="py-line">            <tt class="py-keyword">except</tt> <tt class="py-name">httplib</tt><tt class="py-op">.</tt><tt class="py-name">ResponseNotReady</tt><tt class="py-op">,</tt> <tt class="py-name">e</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno">144</tt>  <tt class="py-line">                <tt class="py-name">e</tt><tt class="py-op">.</tt><tt class="py-name">args</tt> <tt class="py-op">+=</tt> <tt class="py-op">(</tt><tt class="py-string">'You are probably overlapping SQS ops'</tt><tt class="py-op">,</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">145</tt>  <tt class="py-line">                <tt class="py-keyword">raise</tt> <tt class="py-name">e</tt> </tt>
<tt class="py-lineno">146</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">r</tt><tt class="py-op">.</tt><tt class="py-name">status</tt> <tt class="py-op">&lt;</tt> <tt class="py-number">200</tt> <tt class="py-keyword">or</tt> <tt class="py-name">r</tt><tt class="py-op">.</tt><tt class="py-name">status</tt> <tt class="py-op">&gt;</tt> <tt class="py-number">299</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno">147</tt>  <tt class="py-line">                <tt class="py-keyword">raise</tt> <tt id="link-26" class="py-name"><a title="sqs.parsers.parseError" class="py-name" href="#" onclick="return doclink('link-26', 'parseError', 'link-3');">parseError</a></tt></tt><tt class="py-op">(</tt><tt class="py-name">r</tt><tt class="py-op">.</tt><tt id="link-27" class="py-name"><a title="sqs.objects.SQSQueue.read" class="py-name" href="#" onclick="return doclink('link-27', 'read', 'link-23');">read</a></tt></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">148</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-name">r</tt> </tt>
</div><tt class="py-lineno">149</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">f</tt> </tt>
</div></div><tt class="py-lineno">150</tt>  <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="sqs-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">Generated by Epydoc
        3.0alpha3 on Wed Sep 20 12:10:47 2006</td>
    <td align="right" class="footer">
      <a href="http://epydoc.sourceforge.net">http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie()
  // -->
</script>
  
</body>
</html>
